﻿import axios from 'axios'
import ListBoxTable from '@/components/common/ListBoxTable.vue'
import FmUpload from '@/components/common/TheUpload.vue'
// video标签
import VideoUpload from '@/components/Selfdefine/UploadComponent.vue'
// 可编辑的表格中输入内容
import editTableData from '@/components/DynamicFormComponents/EditTableDataInfo.vue'
// 富文本、地图、图片位置等部分编辑的弹窗以及可编辑表格中相关的字段类型的弹窗
import TinymceDialog from '@/components/MetaFormItemComponents/EditElementDataDialog.vue'
// 上传报告的弹窗
import ImportReportDialog from './ImportReportDialog.vue'
// 查看上传文件的弹窗
import ShowUploadFileDialog from '@/components/ShowUploadFileDialog.vue'
// ws事件相关的操作部分
import WSTrigger from '@/components/WebSocketComponents/WebSocketConsole.vue'
import { 
  commonUse_defaultMethod,
  commonUse_setWidgetStatus,
  commonUse_getRelatedComponents
} from '@/components/commonUse.js'
export default {
  props: ['widget', 'models', 'rules', 'pageFormInfo', 'changeModels', 'dynamicUid', 'dialogType', 'pageRow', 'fatherName', 'pPageRow'],
  components: {
    FmUpload, editTableData, ImportReportDialog, ShowUploadFileDialog, WSTrigger, TinymceDialog, VideoUpload, ListBoxTable
  },
  data () {
    return {
      dataModel: this.models[this.widget.model],
      // 当前事件的信息
      currentEventInfo: {
        no: '',
        name: '',
        category: '',
        request_parameters: '',
        response_data: ''
      },
      // 判断事件的类型，RequestUrl是以~开头的是本地事件，否则是http事件
      isLocalEvent: true,
      // 事件的请求和响应的数据----api的键/页面展示的键/值/事件编号
      // inputArray----apiKey/pageKey/eventNo
      // outputArray----apiKey/pageKey/value/eventNo
      pagePrimaryObj: {
        inputArray: [],
        outputArray: []
      },
      // 当前执行事件的集合
      currentEventsObj: null,
      // 可编辑的表格弹窗部分
      clickIndex: null,
      widgetObject: null,
      clickName: null,
      editClickRow: null,
      currentModels: null,
      showEditTableDataDialog: false,
      // 可编辑的表格中下拉框事件的集合
      editTableSelectArray: [],
      // 数据源事件的集合
      sorceEventArray: [],
      // 导入事件的弹窗
      showImportDialog: false,
      // 查看上传附件的弹窗
      showUploadFileDialog_visible: false,
      // 点击行的文件路径列表
      currentRowFileList: [],
      // 需要调用ws的弹窗相关的信息
      wsDialogInfo: {
        visible: false,
        title: '',
        wsApiRouter: ''
      },
      // 富文本字段类型的弹窗
      editElementObj: null,
      showEditElementDataDialog: false,
      currentPageModelsObj: null,
    }
  },
  created () {
    console.debug(this.widget)
    // 服务端获取数据时
    if (this.widget.type === 'select' || this.widget.type === 'radio' || this.widget.type === 'checkbox' || this.widget.type === 'listBox') {
      this.getSelectOptions()
    } else if (this.widget.type === 'table') {
      // 初始化表格事件
      this.initTable()
    } else if (this.widget.type === 'date') {
      // 避免日期格式不正确，导致控件报错
      if (this.models[this.widget.model] && this.models[this.widget.model].indexOf('/') !== -1) {
        this.dataModel = this.models[this.widget.model].replace(/\//g, '-')
      }
    } else if (this.widget.type === 'listBoxTable') {
      this.initListBoxTable()
      this.getListBoxTableLeftData()
    }
    // 设置控件的隐藏状态
    if (Object.keys(this.widget.options).indexOf('hiddenExpress') !== -1 && this.widget.options.hiddenExpress) {
      this.widget.options.isHidden = this.setWidgetStatus(this.widget.options.hiddenExpress)
    }
    // 设置控件的只读状态
    if (Object.keys(this.widget.options).indexOf('disabledExpress') !== -1 && this.widget.options.disabledExpress) {
      this.widget.options.disabled = this.setWidgetStatus(this.widget.options.disabledExpress)
      if (this.widget.type === 'editTable' && Object.keys(this.widget.options).indexOf('showAdd') !== -1) {
        this.widget.options.showAdd = !this.setWidgetStatus(this.widget.options.disabledExpress)
      }
    }
  },
  methods: {
    // 设置控件的只读或者隐藏的状态
    setWidgetStatus (expressJson) {
      // 注：是隐藏、只读表达式，默认显示、可读，则返回 false
      let expressResult = false
      // 常用的固定值的集合
      let fixedValue = {
        formKey: this.dynamicUid,
        limit: 10,
        page: 1
      }
      let submitData = JSON.parse(JSON.stringify(this.models))
      let rowData = null
      let pPageRowData = null
      if (this.pPageRow && !this.$isEmptyObject(this.pPageRow)) {
        submitData = Object.assign(JSON.parse(JSON.stringify(this.pPageRow)), submitData)
        pPageRowData = JSON.parse(JSON.stringify(this.pPageRow))
      }
      if (this.pageRow && !this.$isEmptyObject(this.pageRow)) {
        submitData = Object.assign(JSON.parse(JSON.stringify(this.pageRow)), submitData)
        rowData = JSON.parse(JSON.stringify(this.pageRow))
      }
      expressResult = commonUse_setWidgetStatus(JSON.parse(expressJson), submitData, fixedValue, rowData, pPageRowData)
      return expressResult
    },
    // 获取下拉框的数据
    getSelectOptions () {
      if (this.widget.options.remote && this.widget.options.remoteFunc) {
        if (this.widget.options.inputDic && this.widget.options.outputDic) {
          this.currentEventsObj = {
            inputDic: this.widget.options.inputDic,
            outputDic: this.widget.options.outputDic,
            eventsNo: this.widget.options.remoteFunc
          }
        }
        this.getEventsInfoByEventNo(this.widget.options.remoteFunc, null, this.widget, null, null)
      }
    },
    // 获取ListBoxTable的左侧数据
    getListBoxTableLeftData () {
      if (this.widget.leftDataOptions.remoteFunc) {
        if (this.widget.leftDataOptions.inputDic && this.widget.leftDataOptions.outputDic) {
          this.currentEventsObj = {
            inputDic: this.widget.leftDataOptions.inputDic,
            outputDic: this.widget.leftDataOptions.outputDic,
            eventsNo: this.widget.leftDataOptions.remoteFunc
          }
        }
        this.showLoad(true)
        this.getEventsInfoByEventNo(this.widget.leftDataOptions.remoteFunc, null, this.widget, null, null)
      }
    },
    // 可编辑表格相关的操作
    // 添加数据
    handleAddEditTableData (widget) {
      if (widget.tableColumn.length) {
        let objExam = {}
        widget.tableColumn.forEach(item => {
          let index = item.indexName
          objExam[index] = ''
          // 对于单选或者多选时，添加一个展示的键值对
          if (item.uiType === 'singleSelect' || item.uiType === 'multiSelect') {
            let index_show = item.indexName + '_$SHOW'
            objExam[index_show] = ''
          }
        })
        this.models[widget.model].unshift(objExam)
      }
    },
    // 移除数据
    handleRemoveEditTableData (widget, index) {
      this.$confirm('确定要移除该行数据？', '提示', {
        confirmButtonText: '确定',
        cancelButtonClass: 'el-button--info',
        cancelButtonText: '取消'
      }).then(() => {
        this.models[widget.model].splice(index, 1)
        this.$message({
          message: '移除成功',
          type: 'success'
        })
      }).catch(() => {})
    },
    // 点击某一个单元格时
    rowDataInfo(index, widget, indexName, row) {
      this.showEditTableDataDialog = true
      this.clickIndex = index
      this.clickName = indexName
      this.editClickRow = JSON.parse(JSON.stringify(row))
      this.currentModels = JSON.parse(JSON.stringify(this.models))
      this.widgetObject = JSON.parse(JSON.stringify(widget))
    },
    // 点击确定时（可编辑的表格的弹窗）
    sureEditTableData (fromChild) {
      this.showEditTableDataDialog = false
      this.$set(this.models[fromChild.widgetObject.model][fromChild.index], fromChild.name, fromChild.data)
      if (fromChild.uiType === 'singleSelect' || fromChild.uiType === 'multiSelect') {
        this.$set(this.models[fromChild.widgetObject.model][fromChild.index], fromChild.name + '_$SHOW', fromChild.data_show)
      }
      if (fromChild.linkageElementsData) {
        for (let key in fromChild.linkageElementsData) {
          this.$set(this.models[fromChild.widgetObject.model][fromChild.index], key, fromChild.linkageElementsData[key])
        }
      }
    },
    // 获取可编辑表格中下拉框的事件集合
    getEditTableSelectArray () {
      // this.editTableSelectArray = []
      if (this.widget.tableColumn.length) {
        this.widget.tableColumn.forEach(item => {
          if (item.uiType === 'singleSelect' || item.uiType === 'multiSelect') {
            // 需要调用接口时
            if (item.selectOption.remote && item.selectOption.remoteFunc) {
              // 判断该字段是否已经加入
              let hadPushed = false
              for (let i = 0; i < this.editTableSelectArray.length; i++) {
                if (item.indexName === this.editTableSelectArray[i].editTableItem.indexName) {
                  hadPushed = true
                  break
                }
              }
              if (!hadPushed) {
                let obj = {
                  isTrigger: false,
                  selectOption: item.selectOption,
                  editTableItem: item,
                  widget: this.widget
                }
                this.editTableSelectArray.push(obj)
              }
            } else if (!item.selectOption.remote && item.selectOption.staticOption.length) {
              this.addModelsShowKey (item.indexName, item.selectOption.staticOption, this.widget.model)
            }
          }
        })
      }
      for (let i = 0; i < this.editTableSelectArray.length; i++) {
        if (!this.editTableSelectArray[i].isTrigger) {
          if (this.editTableSelectArray[i].selectOption.inputDic && this.editTableSelectArray[i].selectOption.outputDic) {
            this.currentEventsObj = {
              inputDic: this.editTableSelectArray[i].selectOption.inputDic,
              outputDic: this.editTableSelectArray[i].selectOption.outputDic,
              eventsNo: this.editTableSelectArray[i].selectOption.remoteFunc
            }
          }
          this.editTableSelectArray[i].isTrigger = true
          this.getEventsInfoByEventNo(this.editTableSelectArray[i].selectOption.remoteFunc, null, this.editTableSelectArray[i].widget, 'editTableSelectShow', this.editTableSelectArray[i].editTableItem)
          break
        }
      }
    },
    // 为models中添加一个_$SHOW的字段
    addModelsShowKey (indexName, list, modelsKey) {
      let showText = ''
      if (this.models[modelsKey].length) {
        this.models[modelsKey].forEach((item, index) => {
          for (let i = 0; i < list.length; i++) {
            if (list[i].value === item[indexName]) {
              showText = list[i].label
              this.$set(this.models[modelsKey][index], indexName + '_$SHOW', showText)
              break
            }
          }
        })
      }
    },
    // 初始化表格事件
    initTable () {
      // 将行事件情况
      this.widget.options.rowEvents = []
      this.widget.options.rowEvents[0] = {}
      if (this.pageFormInfo.pageConfig.events.length) {
        this.pageFormInfo.pageConfig.events.forEach(item => {
          // 获取到初始化事件
          if (item.eventsType === 'initTable' && item.eventsNo && item.relatedTag === this.widget.model) {
            this.currentEventsObj = JSON.parse(JSON.stringify(item))
            if (item.pageType === 'back') {
              this.getEventsInfoByEventNo(item.eventsNo, 'isBack', this.widget, null, null)
            } else {
              this.getEventsInfoByEventNo(item.eventsNo, 'isFront', this.widget, null, null)
            }
          }
          // 获取该表格的行事件
          if (item.relatedTag === this.widget.model && item.eventsType !== 'initTable') {
            let hadSameType = false
            for (let i = 0; i < this.widget.options.rowEvents.length; i++) {
              for (let rowEventsKey in this.widget.options.rowEvents[i]) {
                if (item.eventsType === 'selfDefineTable') {
                  if (rowEventsKey === 'slefEvent_' + item.selfName) {
                    hadSameType = true
                  }
                } else if (item.eventsType === 'selfDefineDialogTable') {
                  if (rowEventsKey === 'slefDialog_' + item.selfName) {
                    hadSameType = true
                  }
                } else if (item.eventsType === 'selfDefinePageTable') {
                  if (rowEventsKey === 'slefPage_' + item.selfName) {
                    hadSameType = true
                  }
                } else if (item.eventsType === 'selfDefinePageTable_openPage') {
                  if (rowEventsKey === 'slefOpenPage_' + item.selfName) {
                    hadSameType = true
                  }
                } else {
                  if (rowEventsKey === item.eventsType) {
                    hadSameType = true
                  }
                }
              }
            }
            if (item.eventsType === 'selfDefineTable') {
              if (!hadSameType && !this.widget.options.rowEvents[0]['slefEvent_' + item.selfName]) {
                this.widget.options.rowEvents[0]['slefEvent_' + item.selfName] = []
                this.$set(this.widget.options.rowEvents[0]['slefEvent_' + item.selfName], 0, item)
              } else {
                this.$set(this.widget.options.rowEvents[0]['slefEvent_' + item.selfName], this.widget.options.rowEvents[0]['slefEvent_' + item.selfName].length, item)
              }
            } else if (item.eventsType === 'selfDefineDialogTable') {
              if (!hadSameType && !this.widget.options.rowEvents[0]['slefDialog_' + item.selfName]) {
                this.widget.options.rowEvents[0]['slefDialog_' + item.selfName] = []
                this.$set(this.widget.options.rowEvents[0]['slefDialog_' + item.selfName], 0, item)
              } else {
                this.$set(this.widget.options.rowEvents[0]['slefDialog_' + item.selfName], this.widget.options.rowEvents[0]['slefDialog_' + item.selfName].length, item)
              }
            } else if (item.eventsType === 'selfDefinePageTable') {
              if (!hadSameType && !this.widget.options.rowEvents[0]['slefPage_' + item.selfName]) {
                this.widget.options.rowEvents[0]['slefPage_' + item.selfName] = []
                this.$set(this.widget.options.rowEvents[0]['slefPage_' + item.selfName], 0, item)
              } else {
                this.$set(this.widget.options.rowEvents[0]['slefPage_' + item.selfName], this.widget.options.rowEvents[0]['slefPage_' + item.selfName].length, item)
              }
            } else if (item.eventsType === 'selfDefinePageTable_openPage') {
              if (!hadSameType && !this.widget.options.rowEvents[0]['slefOpenPage_' + item.selfName]) {
                this.widget.options.rowEvents[0]['slefOpenPage_' + item.selfName] = []
                this.$set(this.widget.options.rowEvents[0]['slefOpenPage_' + item.selfName], 0, item)
              } else {
                this.$set(this.widget.options.rowEvents[0]['slefOpenPage_' + item.selfName], this.widget.options.rowEvents[0]['slefOpenPage_' + item.selfName].length, item)
              }
            } else {
              if (!hadSameType && !this.widget.options.rowEvents[0][item.eventsType]) {
                this.widget.options.rowEvents[0][item.eventsType] = []
                this.$set(this.widget.options.rowEvents[0][item.eventsType], 0, item)
              } else {
                this.$set(this.widget.options.rowEvents[0][item.eventsType], this.widget.options.rowEvents[0][item.eventsType].length, item)
              }
            }
          }
          if (this.widget.options.rowEvents[0] && this.$isEmptyObject(this.widget.options.rowEvents[0])) {
            for (let key in this.widget.options.rowEvents[0]) {
              this.widget.options.rowEvents[0][key].sort(this.orderByObjAttr('actionIndex'))
            }
          }
        })
      }
    },
    // 对象数组排序
    orderByObjAttr (key) {
      return function (val1, val2) {
        return val1[key] - val2[key]
      }
    },
    // 通过元素的model找到其绑定的事件---或指定的事件类型(表格的初始化事件)
    getEventsByTagModel (tagModel, eventType) {
      let targetEventInfo = null
      let targetEventInfoArray = []
      if (this.pageFormInfo.pageConfig.events.length && tagModel) {
        this.pageFormInfo.pageConfig.events.forEach(item => {
          if (eventType && (eventType === 'initTable' || eventType === 'searchInfo')) {
            if (item.relatedTag === tagModel && item.eventsType === eventType) {
              targetEventInfo = item
              this.currentEventsObj = item
            }
          } else {
            if (item.relatedTag === tagModel) {
              targetEventInfoArray.push(item)
            }
          }
        })
      }
      if (eventType !== 'initTable' && eventType !== 'searchInfo') {
        if (targetEventInfoArray.length) {
          targetEventInfoArray.sort(this.orderByObjAttr('actionIndex'))
        }
        return targetEventInfoArray
      } else {
        return targetEventInfo
      }
    },
    // 根据事件编号获取该事件的key值
    getEventKeyByEventNo (targetEventNo) {
      // 每次将this.pagePrimaryObj.inputArray清空
      this.pagePrimaryObj.inputArray = []
      if (this.currentEventsObj && !this.$isEmptyObject(this.currentEventsObj) && this.currentEventsObj.inputDic) {
        // 输入的参数格式为：api中的键名 = 页面展示的键名
        for (let i = 0; i < this.currentEventsObj.inputDic.length; i++) {
          if (this.currentEventsObj.inputDic[i].inputKey.indexOf('=') !== -1) {
            let dicInputArray = this.currentEventsObj.inputDic[i].inputKey.split('=')
            let obj = {
              apiKey: dicInputArray[0],
              pageKey: dicInputArray[1],
              eventNo: targetEventNo
            }
            this.pagePrimaryObj.inputArray.push(obj)
          }
        }
      }
      // 获取输出的参数
      if (this.currentEventsObj && !this.$isEmptyObject(this.currentEventsObj) && this.currentEventsObj.outputDic) {
        // 输出的参数格式为： 页面展示的键名 = api中的键名
        for (let i = 0; i < this.currentEventsObj.outputDic.length; i++) {
          if (this.currentEventsObj.outputDic[i].outputKey.indexOf('=') !== -1) {
            let dicOutputArray = this.currentEventsObj.outputDic[i].outputKey.split('=')
            let hadPushed = false
            // 判断该事件的输出参数是否已经加入过一次
            if (this.pagePrimaryObj.outputArray.length) {
              for (let i = 0; i < this.pagePrimaryObj.outputArray.length; i++) {
                if (targetEventNo === this.pagePrimaryObj.outputArray[i].eventNo && this.pagePrimaryObj.outputArray[i].apiKey === dicOutputArray[1] && this.pagePrimaryObj.outputArray[i].pageKey === dicOutputArray[0]) {
                  hadPushed = true
                }
              }
            }
            if (!hadPushed) {
              let obj = {
                apiKey: dicOutputArray[1],
                pageKey: dicOutputArray[0],
                value: null,
                eventNo: targetEventNo
              }
              this.pagePrimaryObj.outputArray.push(obj)
            }
          }
        }
      }
    },
    // 根据事件编号获取事件详细(事件编号，分页模式--表格，当前元素，触发模式--联动时, 字段名称---可编辑表格的下拉框)
    getEventsInfoByEventNo (eventItemNo, pageType, tableItem, triggerType, editTableItem) {
      let submitData = JSON.parse(JSON.stringify(this.models))
      if (this.pPageRow && !this.$isEmptyObject(this.pPageRow)) {
        submitData = Object.assign(JSON.parse(JSON.stringify(this.pPageRow)), submitData)
      }
      if (this.pageRow && !this.$isEmptyObject(this.pageRow)) {
        submitData = Object.assign(JSON.parse(JSON.stringify(this.pageRow)), submitData)
      }
      // 获取该事件的key值
      this.getEventKeyByEventNo(eventItemNo)
      // 获取事件的详细
      this.$get('/events4dform/' + eventItemNo).then(data => {
        let dataInfo = data.data.result
        if (dataInfo.code === 'failed') {
          this.$message({
            message: dataInfo.msg,
            type: 'error'
          })
          this.$store.dispatch('changRouteLoading', false)
        }
        if (dataInfo.code === 'success') {
          this.currentEventInfo = {
            no: dataInfo.data.no,
            name: dataInfo.data.name,
            category: dataInfo.data.category,
            request_parameters: dataInfo.data.request_parameters,
            response_data: dataInfo.data.response_data
          }
          // 需要先判断事件是否为ws事件
          if (this.currentEventInfo.request_parameters) {
            let parametersObj = JSON.parse(this.currentEventInfo.request_parameters)
            if (parametersObj.RequestUrl.indexOf('~') === 0 && parametersObj.RequestMethod === 'WS') {
              // 获取触发事件的parameters
              let evalParamters = {}
              if (this.pagePrimaryObj.inputArray.length) {
                this.pagePrimaryObj.inputArray.forEach(item => {
                  // 找到该事件对应的参数
                  if (item.eventNo === eventItemNo) {
                    // 判断apiKey是否是 Query.key的结构（Query表示的是字段名，key表示的是该对象中的一个属性）
                    if (item.apiKey.indexOf('.') !== -1) {
                      let apiObjString = item.apiKey.split('.')
                      // 需要先判断该对象是否已经存在于evalParamters中
                      if (Object.keys(evalParamters).indexOf(apiObjString[0]) === -1) {
                        evalParamters[apiObjString[0]] = {}
                      }
                      evalParamters[apiObjString[0]][apiObjString[1]] = this.getInputParamsMethods(item.pageKey)
                    } else {
                      evalParamters[item.apiKey] = this.getInputParamsMethods(item.pageKey)
                    }
                  }
                })
              }
              // 修改后的参数--如果有词典表，则获取词典表中的数据值，否者就直接为models中的值
              let parameters = this.$isEmptyObject(evalParamters) ? submitData : evalParamters
              let wsQueryStringArray = []
              if (parametersObj.RequestQueryString && !this.$isEmptyObject(parametersObj.RequestQueryString) && parameters && !this.$isEmptyObject(parameters)) {
                for (let searchKey in parametersObj.RequestQueryString) {
                  for (let parametersKey in parameters) {
                    if (searchKey === parametersKey) {
                      let queryArrayString = searchKey + '=' + parameters[parametersKey]
                      wsQueryStringArray.push(queryArrayString)
                    }
                  }
                } 
              }
              // 获取ws请求的url地址
              let wsApiRouter = parametersObj.RequestUrl.slice(1)
              if (wsQueryStringArray.length) {
                wsApiRouter = wsApiRouter + '?' + wsQueryStringArray.join('&')
              }
              // 触发ws相关的事件
              this.$set(this.wsDialogInfo, 'visible', true)
              this.$set(this.wsDialogInfo, 'title', dataInfo.data.name)
              this.$set(this.wsDialogInfo, 'wsApiRouter', wsApiRouter)
              this.$store.dispatch('changRouteLoading', false)
              return
            } else {
              // 触发事件前修改事件参数
              this.changeEventsInfoBeforeSubmit(eventItemNo, pageType, tableItem, triggerType, editTableItem)
            }
          } else {
            this.$message({
              message: '没有获取到触发事件的相关信息',
              type: 'error'
            })
            this.$store.dispatch('changRouteLoading', false)
          }
        }
      }).catch(error => {
        this.$message({
          message: error,
          type: 'error'
        })
        this.$store.dispatch('changRouteLoading', false)
      })
    },
    // 修改输入参数的公共方法
    getInputParamsMethods (pageKey, relatedPage, currentRow) {
      let submitData = JSON.parse(JSON.stringify(this.models))
      if (this.pPageRow && !this.$isEmptyObject(this.pPageRow)) {
        submitData = Object.assign(JSON.parse(JSON.stringify(this.pPageRow)), submitData)
      }
      if (this.pageRow && !this.$isEmptyObject(this.pageRow)) {
        submitData = Object.assign(JSON.parse(JSON.stringify(this.pageRow)), submitData)
      }
      if (currentRow && !this.$isEmptyObject(currentRow)) {
        submitData = Object.assign(JSON.parse(JSON.stringify(currentRow)), submitData)
      }
      let fixedValue = {
        formKey: this.dynamicUid,
        limit: relatedPage ? relatedPage.options.pageSize : 10,
        page: relatedPage ? relatedPage.options.currentPage : 1
      }
      let rowData = (this.pageRow && !this.$isEmptyObject(this.pageRow)) ? JSON.parse(JSON.stringify(this.pageRow)) : null
      let pPageRowData = (this.pPageRow && !this.$isEmptyObject(this.pPageRow)) ? JSON.parse(JSON.stringify(this.pPageRow)) : null
      return commonUse_defaultMethod(pageKey, submitData, fixedValue, rowData, pPageRowData)
    },
    // 修改事件的参数----主要是需要修改事件path、search、postData等参数
    changeEventsInfoBeforeSubmit (eventItemNo, pageType, tableItem, triggerType, editTableItem) {
      // 找到关联的页码
      let relatedPage = null
      // 当为表格时
      if (tableItem && tableItem.type === 'table' && tableItem.relatedComponents.length) {
        tableItem.relatedComponents.forEach(item => {
          if (item.modelKey && item.modelKey.slice(0, item.modelKey.indexOf('_')) === 'pagination') {
            relatedPage =  commonUse_getRelatedComponents(this.pageFormInfo.list, item.modelKey)
          }
        })
      }
      if (this.currentEventInfo.request_parameters) {
        let parametersObj = JSON.parse(this.currentEventInfo.request_parameters)
        // 判断事件的类型，RequestUrl是以~开头的是本地事件，否则是http事件
        if (parametersObj.RequestUrl.indexOf('~') === 0) {
          this.isLocalEvent = true
        } else {
          this.isLocalEvent = false
        }
        // 获取触发事件的parameters
        let evalParamters = {}
        if (this.pagePrimaryObj.inputArray.length) {
          this.pagePrimaryObj.inputArray.forEach(item => {
            // 找到该事件对应的参数
            if (item.eventNo === eventItemNo) {
              // 判断apiKey是否是 Query.key的结构（Query表示的是字段名，key表示的是该对象中的一个属性）
              if (item.apiKey.indexOf('.') !== -1) {
                let apiObjString = item.apiKey.split('.')
                // 需要先判断该对象是否已经存在于evalParamters中
                if (Object.keys(evalParamters).indexOf(apiObjString[0]) === -1) {
                  evalParamters[apiObjString[0]] = {}
                }
                evalParamters[apiObjString[0]][apiObjString[1]] = this.getInputParamsMethods(item.pageKey, relatedPage)
              } else {
                evalParamters[item.apiKey] = this.getInputParamsMethods(item.pageKey, relatedPage)
              }
            }
          })
        }
        let toEvalMethodJsonString = this.$isEmptyObject(evalParamters) ? '' : evalParamters
        this.triggerInitDataEvents(eventItemNo, pageType, tableItem, toEvalMethodJsonString, triggerType, editTableItem)
      }
    },
    // 触发初始化页面事件
    triggerInitDataEvents (eventItemNo, pageType, tableItem, parameters, triggerType, editTableItem) {
      let submitData = JSON.parse(JSON.stringify(this.models))
      if (this.pPageRow && !this.$isEmptyObject(this.pPageRow)) {
        submitData = Object.assign(JSON.parse(JSON.stringify(this.pPageRow)), submitData)
      }
      if (this.pageRow && !this.$isEmptyObject(this.pageRow)) {
        submitData = Object.assign(JSON.parse(JSON.stringify(this.pageRow)), submitData)
      }
      let self = this
      if (this.isLocalEvent) {
        this.$post('/events4dform/' + eventItemNo + '/eval', {
          this_data: '',
          parameters: parameters
        }).then(data => {
          self.showLoad(false)
          let dataInfo = data.data.result
          this.currentEventsObj = null
          this.afterEval (dataInfo, pageType, tableItem, eventItemNo, triggerType, editTableItem)
        }).catch(error => {
          self.showLoad(false)
          this.$store.dispatch('changRouteLoading', false)
          this.$message({
            message: error,
            type: 'warning'
          })
        })
      } else {
        // http事件的出发方式
        if (this.currentEventInfo.request_parameters) {
          let requestObj = JSON.parse(this.currentEventInfo.request_parameters)
          if (!this.$isEmptyObject(requestObj) && requestObj.RequestUrl && requestObj.RequestMethod) {
            let axiosUrl = requestObj.RequestUrl
            // 改变path
            if (requestObj.RequestPath && !this.$isEmptyObject(requestObj.RequestPath)) {
              // 获取请求的url中的path---将url中的变量的改为获取到的值
              for (let pathKey in requestObj.RequestPath) {
                for (let modelKey in submitData) {
                  if (pathKey === modelKey) {
                    axiosUrl = axiosUrl.replace('{' + pathKey + '}', submitData[pathKey])
                  }
                }
              }
            }
            // 修改query的值
            let axiosQuery = {}
            if (requestObj.RequestQueryString && !this.$isEmptyObject(requestObj.RequestQueryString) && parameters) {
              for (let searchKey in requestObj.RequestQueryString) {
                for (let parametersKey in parameters) {
                  if (searchKey === parametersKey) {
                    axiosQuery[searchKey] = parameters[parametersKey]
                  }
                }
              } 
            }
            // 修改postData的值
            let axiosPostData = {}
            if (requestObj.RequestPostData && !this.$isEmptyObject(requestObj.RequestPostData) && parameters) {
              for (let postKey in requestObj.RequestPostData) {
                for (let parametersKey in parameters) {
                  if (postKey === parametersKey) {
                    axiosPostData[postKey] = parameters[parametersKey]
                  }
                }
              } 
            }
            axios({
              url: axiosUrl,
              method: requestObj.RequestMethod,
              // headers: requestObj.RequestHeader,
              data: axiosPostData,
              params: axiosQuery
            }).then(data => {
              self.showLoad(false)
              let dataInfo = data.data.result
              this.currentEventsObj = null
              this.afterEval (dataInfo, pageType, tableItem, eventItemNo, triggerType, editTableItem)
            }).catch(error => {
              self.showLoad(false)
              this.$store.dispatch('changRouteLoading', false)
              this.$message({
                message: error,
                type: 'error'
              })
            })
          }
        }
      }
    },
    // 事件触发后
    afterEval (dataInfo, pageType, tableItem, eventItemNo, triggerType, editTableItem) {
      if (dataInfo.code === 'failed') {
        this.$store.dispatch('changRouteLoading', false)
        this.$message({
          message: dataInfo.msg,
          type: 'error'
        })
      } else if (dataInfo.code === 'success') {
        if (triggerType) {
          // 当为联动触发事件时- 触发事件后修改页面的数据
          if (triggerType === 'changeClickRowData') {
            this.$store.dispatch('changRouteLoading', false)
            let dataObj = dataInfo.data
            if (this.$isArray(dataInfo.data)) {
              dataObj = dataInfo.data[0]
            }
            // 根据输出词典表，修改dataObj中的值
            for (let i = 0; i < this.pagePrimaryObj.outputArray.length; i++) {
              if (this.pagePrimaryObj.outputArray[i].eventNo === eventItemNo) {
                for (let dKey in dataObj) {
                  // 如果返回的值的某一个键设置的词典表，则将该词典表对于的pageKey设置对于的值并存在返回值的集合中
                  if (this.pagePrimaryObj.outputArray[i].apiKey === dKey) {
                    this.$set(dataObj, this.pagePrimaryObj.outputArray[i].pageKey, dataObj[dKey])
                  }
                }
              }
            }
            // 如果设置了联动元素---将获取的值赋予页面对应的元素
            if (tableItem.options.linkageOption.linkageElements && tableItem.options.linkageOption.linkageElements.length) {
              let linkageElementsArray = tableItem.options.linkageOption.linkageElements
              for (let i = 0; i < linkageElementsArray.length; i++) {
                for (let mKey in this.models) {
                  if (mKey === linkageElementsArray[i]) {
                    this.$set(this.models, mKey, dataObj[mKey])
                  }
                }
              }
              // 改变页面models的值
              this.$emit('modelsChangedByLinkage', this.models)
            }
          } else if (triggerType === 'exportReport') {
            // 当为导出报表时
            this.$store.dispatch('changRouteLoading', false)
            let content = decodeURIComponent(dataInfo.file)
            let blobContent = this.toBlob(content, dataInfo.filetype)
            this.downloadblob(blobContent, dataInfo.filename)
          } else if (triggerType === 'editTableSelectShow') {
            // 当为获取可编辑表格的下拉框值对应的label时
            // 根据输出词典表，修改dataInfo.data中的值
            for (let i = 0; i < this.pagePrimaryObj.outputArray.length; i++) {
              if (this.pagePrimaryObj.outputArray[i].eventNo === eventItemNo) {
                for (let i = 0; i < dataInfo.data.length; i++) {
                  for (let dKey in dataInfo.data[i]) {
                    // 如果返回的值的某一个键设置的词典表，则将该词典表对于的pageKey设置对于的值并存在返回值的集合中
                    if (this.pagePrimaryObj.outputArray[i].apiKey === dKey) {
                      this.$set(dataInfo.data[i], this.pagePrimaryObj.outputArray[i].pageKey, dataInfo.data[i][dKey])
                    }
                  }
                }
              }
            }
            // 判断还有没有事件需要执行
            let hadUnTrugger = false
            for (let i = 0; i < this.editTableSelectArray.length; i++) {
              if (!this.editTableSelectArray[i].isTrigger) {
                hadUnTrugger = true
                if (this.editTableSelectArray[i].selectOption.inputDic && this.editTableSelectArray[i].selectOption.outputDic) {
                  this.currentEventsObj = {
                    inputDic: this.editTableSelectArray[i].selectOption.inputDic,
                    outputDic: this.editTableSelectArray[i].selectOption.outputDic,
                    eventsNo: this.editTableSelectArray[i].selectOption.remoteFunc
                  }
                }
                this.editTableSelectArray[i].isTrigger = true
                this.getEventsInfoByEventNo(this.editTableSelectArray[i].selectOption.remoteFunc, null, this.editTableSelectArray[i].widget, 'editTableSelectShow', this.editTableSelectArray[i].editTableItem)
                break
              }
            }
            let dataArray = []
            dataArray = dataInfo.data.map(item => {
              return {
                value: item[editTableItem.selectOption.remoteProps.value],
                label: item[editTableItem.selectOption.remoteProps.label]
              }
            })
            // 修改对应的models中的值
            this.addModelsShowKey (editTableItem.indexName, dataArray, tableItem.model)
            // 所有的事件执行完成时
            if (!hadUnTrugger) {
              this.$store.dispatch('changRouteLoading', false)
            }
          } else if (triggerType === 'changeDataSource') {
            // 联动方式改变数据源
            if (tableItem.type === 'select' || tableItem.type === 'radio' || tableItem.type === 'checkbox' || tableItem.type === 'listBox') {
              if (dataInfo.data) {
                tableItem.options.remoteOptions = dataInfo.data.map(item => {
                  return {
                    value: item[tableItem.options.props.value],
                    label: item[tableItem.options.props.label]
                  }
                })
              }
            }
            // 触发数据源事件，改变指定元素的数据源
            // 判断还有没有事件需要执行
            let hadUnTrugger = false
            for (let i = 0; i < this.sorceEventArray.length; i++) {
              if (!this.sorceEventArray[i].isTrigger) {
                hadUnTrugger = true
                this.currentEventsObj = {
                  inputDic: this.sorceEventArray[i].inputDic,
                  outputDic: this.sorceEventArray[i].outputDic,
                  eventsNo: this.sorceEventArray[i].eventsNo
                }
                this.sorceEventArray[i].isTrigger = true
                this.getEventsInfoByEventNo(this.sorceEventArray[i].eventsNo, null, this.sorceEventArray[i].widget, 'changeDataSource', null)
                break
              }
            }
            // 所有的事件执行完成时
            if (!hadUnTrugger) {
              this.$store.dispatch('changRouteLoading', false)
            }
          } else if (triggerType === 'selfDefineTable_export') {
            // 当为表格行导出事件时
            this.$store.dispatch('changRouteLoading', false)
            let content = decodeURIComponent(dataInfo.file)
            let blobContent = this.toBlob(content, dataInfo.filetype)
            this.downloadblob(blobContent, dataInfo.filename)
          } else if (triggerType === 'listBoxTableChanged') {
            this.$refs[tableItem.key].loadTableData(dataInfo.data)
          }
        } else {
          this.$store.dispatch('changRouteLoading', false)
          // 当为组件的初始化时
          if (tableItem.type === 'table') {
            this.initItemData(dataInfo.data, pageType, tableItem, eventItemNo)
          } else if (tableItem.type === 'select' || tableItem.type === 'radio' || tableItem.type === 'checkbox' || tableItem.type === 'listBox') {
            if (dataInfo.data) {
              tableItem.options.remoteOptions = dataInfo.data.map(item => {
                return {
                  value: item[tableItem.options.props.value],
                  label: item[tableItem.options.props.label]
                }
              })
            }
            if (Object.keys(tableItem.options).indexOf('linkageOption') !== -1 && tableItem.options.linkageOption.isLinkage && tableItem.options.linkageOption.linkageType === 'eventRenderDataSource' && this.dialogType !== 'showDetail') {
              this.setLinkageOptions(tableItem.options.linkageOption, tableItem)
            }
          } else if (tableItem.type === 'listBoxTable') {
            this.$refs[tableItem.key].loadLeftData(dataInfo.data)
          }
        }
      } else {
        if (triggerType) {
          // 当为联动触发事件时
          if (triggerType === 'changeClickRowData') {
            this.$store.dispatch('changRouteLoading', false)
            let dataObj = dataInfo
            if (this.$isArray(dataInfo)) {
              dataObj = dataInfo[0]
            }
            // 根据输出词典表，修改dataObj中的值
            for (let i = 0; i < this.pagePrimaryObj.outputArray.length; i++) {
              if (this.pagePrimaryObj.outputArray[i].eventNo === eventItemNo) {
                for (let dKey in dataObj) {
                  // 如果返回的值的某一个键设置的词典表，则将该词典表对于的pageKey设置对于的值并存在返回值的集合中
                  if (this.pagePrimaryObj.outputArray[i].apiKey === dKey) {
                    this.$set(dataObj, this.pagePrimaryObj.outputArray[i].pageKey, dataObj[dKey])
                  }
                }
              }
            }
            // 如果设置了联动元素---将获取的值赋予页面对应的元素
            if (tableItem.options.linkageOption.linkageElements && tableItem.options.linkageOption.linkageElements.length) {
              let linkageElementsArray = tableItem.options.linkageOption.linkageElements
              for (let i = 0; i < linkageElementsArray.length; i++) {
                for (let mKey in this.models) {
                  if (mKey === linkageElementsArray[i]) {
                    this.$set(this.models, mKey, dataObj[mKey])
                  }
                }
              }
              // 改变页面models的值
              this.$emit('modelsChangedByLinkage', this.models)
            }
          } else if (triggerType === 'exportReport') {
            this.$store.dispatch('changRouteLoading', false)
            // 当为导出报表时
            let content = decodeURIComponent(dataInfo.file)
            let blobContent = this.toBlob(content, dataInfo.filetype)
            this.downloadblob(blobContent, dataInfo.filename)
          } else if (triggerType === 'editTableSelectShow') {
            // 当为获取可编辑表格的下拉框值对应的label时
            // 根据输出词典表，修改dataInfo中的值
            for (let i = 0; i < this.pagePrimaryObj.outputArray.length; i++) {
              if (this.pagePrimaryObj.outputArray[i].eventNo === eventItemNo) {
                for (let i = 0; i < dataInfo.length; i++) {
                  for (let dKey in dataInfo[i]) {
                    // 如果返回的值的某一个键设置的词典表，则将该词典表对于的pageKey设置对于的值并存在返回值的集合中
                    if (this.pagePrimaryObj.outputArray[i].apiKey === dKey) {
                      this.$set(dataInfo[i], this.pagePrimaryObj.outputArray[i].pageKey, dataInfo[i][dKey])
                    }
                  }
                }
              }
            }
            let dataArray = []
            dataArray = dataInfo.map(item => {
              return {
                value: item[editTableItem.selectOption.remoteProps.value],
                label: item[editTableItem.selectOption.remoteProps.label]
              }
            })
            // 修改对应的models中的值
            this.addModelsShowKey (editTableItem.indexName, dataArray, tableItem.model)
            // 判断还有没有事件需要执行
            let hadUnTrugger = false
            for (let i = 0; i < this.editTableSelectArray.length; i++) {
              if (!this.editTableSelectArray[i].isTrigger) {
                hadUnTrugger = true
                if (this.editTableSelectArray[i].selectOption.inputDic && this.editTableSelectArray[i].selectOption.outputDic) {
                  this.currentEventsObj = {
                    inputDic: this.editTableSelectArray[i].selectOption.inputDic,
                    outputDic: this.editTableSelectArray[i].selectOption.outputDic,
                    eventsNo: this.editTableSelectArray[i].selectOption.remoteFunc
                  }
                }
                this.getEventsInfoByEventNo(this.editTableSelectArray[i].selectOption.remoteFunc, null, this.editTableSelectArray[i].widget, 'editTableSelectShow', this.editTableSelectArray[i].editTableItem)
                this.editTableSelectArray[i].isTrigger = true
                break
              }
            }
            // 所有的事件执行完成时
            if (!hadUnTrugger) {
              this.$store.dispatch('changRouteLoading', false)
            }
          } else if (triggerType === 'changeDataSource') {
            // 联动方式改变数据源
            if (tableItem.type === 'select' || tableItem.type === 'radio' || tableItem.type === 'checkbox' || tableItem.type === 'listBox') {
              if (dataInfo) {
                tableItem.options.remoteOptions = dataInfo.map(item => {
                  return {
                    value: item[tableItem.options.props.value],
                    label: item[tableItem.options.props.label]
                  }
                })
              }
            }
            // 触发数据源事件，改变指定元素的数据源
            // 判断还有没有事件需要执行
            let hadUnTrugger = false
            for (let i = 0; i < this.sorceEventArray.length; i++) {
              if (!this.sorceEventArray[i].isTrigger) {
                hadUnTrugger = true
                this.currentEventsObj = {
                  inputDic: this.sorceEventArray[i].inputDic,
                  outputDic: this.sorceEventArray[i].outputDic,
                  eventsNo: this.sorceEventArray[i].eventsNo
                }
                this.sorceEventArray[i].isTrigger = true
                this.getEventsInfoByEventNo(this.sorceEventArray[i].eventsNo, null, this.sorceEventArray[i].widget, 'changeDataSource', null)
                break
              }
            }
            // 所有的事件执行完成时
            if (!hadUnTrugger) {
              this.$store.dispatch('changRouteLoading', false)
            }
          } else if (triggerType === 'listBoxTableChanged') {
            this.$refs[tableItem.key].loadTableData(dataInfo)
          }
        } else {
          // 当为组件的初始化时
          this.$store.dispatch('changRouteLoading', false)
          if (tableItem.type === 'table') {
            this.initItemData(dataInfo, pageType, tableItem, eventItemNo)
          } else if (tableItem.type === 'select' || tableItem.type === 'radio' || tableItem.type === 'checkbox' || tableItem.type === 'listBox') {
            if (dataInfo) {
              tableItem.options.remoteOptions = dataInfo.map(item => {
                return {
                  value: item[tableItem.options.props.value],
                  label: item[tableItem.options.props.label]
                }
              })
            }
          } else if (tableItem.type === 'listBoxTable') {
            this.$refs[tableItem.key].loadLeftData(dataInfo.data)
          }
        }
      }
    },
    // initData事件的结果进行渲染
    initItemData (resultData, pageType, tableItem, eventItemNo) {
      if (tableItem.type === 'table') {
        tableItem.totalData = resultData
        // 自动生成表头
        if (tableItem.options.isAutoColumnFromData) {
          let firstRow = {}
          if (pageType === 'isFront') {
            firstRow = tableItem.totalData[0]
          } else {
            firstRow = tableItem.totalData.QueryDatas[0]
          }
          tableItem.tableColumn = []
          for (let k in firstRow) {
            tableItem.tableColumn.push({
              text: k,
              indexName: k,
              isBoolean: firstRow[k] && typeof(firstRow[k]) === 'boolean' ? true : false,
              isFile: false
            })
          }
        }
        // 找到关联的页码
        let relatedPage = null
        if (tableItem.relatedComponents.length) {
          tableItem.relatedComponents.forEach(item => {
            if (item.modelKey && item.modelKey.slice(0, item.modelKey.indexOf('_')) === 'pagination') {
              relatedPage = commonUse_getRelatedComponents(this.pageFormInfo.list, item.modelKey)
            }
          })
        }
        if (relatedPage && pageType === 'isFront') {
          relatedPage.options.totalLength = tableItem.totalData.length
          if (this.pagePrimaryObj.outputArray.length) {
            this.pagePrimaryObj.outputArray.forEach((item) => {
              if (item.eventNo === eventItemNo) {
                for (let i = 0; i < tableItem.totalData.length; i++) {
                  let hadRowKey = false
                  for (let rowKey in tableItem.totalData[i]) {
                    if (item.pageKey === rowKey) {
                      hadRowKey = true
                    }
                  }
                  if (!hadRowKey) {
                    this.$set(tableItem.totalData[i], item.pageKey, tableItem.totalData[i][item.apiKey])
                  }
                }
              }
            })
          }
          this.showData(tableItem.totalData, tableItem, relatedPage)
        } else if (relatedPage && pageType === 'isBack') {
          tableItem.tableData = resultData.QueryDatas
          // 设置当前行事件的隐藏的表达式
          if (tableItem.options.rowEvents.length && !this.$isEmptyObject(tableItem.options.rowEvents[0]) && resultData.QueryDatas.length) {
            tableItem.tableData = []
            resultData.QueryDatas.forEach(item => {
              item['rowEventHideExpress'] = {}
              for (let rowEventsItem in tableItem.options.rowEvents[0]) {
                // 默认情况下，按钮都是显示的--这里是隐藏的表达式
                item['rowEventHideExpress'][rowEventsItem] = false
                // 查看详细的按钮一直显示--不需要判断
                if (rowEventsItem !== 'showDetail') {
                  item['rowEventHideExpress'][rowEventsItem] = this.getRowEventHideExpressMethod(tableItem.options.rowEvents[0][rowEventsItem], item)
                }
              }
              this.$set(tableItem.tableData, tableItem.tableData.length, item)
            })
          }
          if (this.pagePrimaryObj.outputArray.length) {
            this.pagePrimaryObj.outputArray.forEach((item) => {
              if (item.eventNo === eventItemNo) {
                for (let i = 0; i < tableItem.tableData.length; i++) {
                  let hadRowKey = false
                  for (let rowKey in tableItem.tableData[i]) {
                    if (item.pageKey === rowKey) {
                      hadRowKey = true
                    }
                  }
                  if (!hadRowKey) {
                    this.$set(tableItem.tableData[i], item.pageKey, tableItem.tableData[i][item.apiKey])
                  }
                }
              }
            })
          }
          relatedPage.options.totalLength = resultData.TotalRow
        } else {
          tableItem.tableData = resultData.QueryDatas
        }
      }
    },
    // 获取表格行事件的隐藏的表达式---默认时显示的，即不设置时返回的是 false
    // 表达式的值为json字符串
    // key为本行数据的key，默认情况下多个判断条件为 &&， 当为 || 时，需要在key前加上 $or_ 字符
    // value分两种类型，对象和数组类型，对象类型时，表示该key对应value的多个判断条件 &&，数组就表示多个判断条件 ||
    // 本方法接受两个参数 rowEventArray--该行事件的事件集合，只需要找到一个有 row_express 表达式即可， rowItem--改行的数据集合
    getRowEventHideExpressMethod (rowEventArray, rowItem) {
      // 注：是隐藏表达式，默认显示，则返回 false
      let hideExpressResult = false
      for (let i = 0; i < rowEventArray.length; i++) {
        if (Object.keys(rowEventArray[i]).indexOf('row_express') !== -1 && rowEventArray[i]['row_express']) {
          // 常用的固定值的集合
          let fixedValue = {
            formKey: this.dynamicUid,
            limit: 10,
            page: 1
          }
          let rowData = (this.pageRow && !this.$isEmptyObject(this.pageRow)) ? JSON.parse(JSON.stringify(this.pageRow)) : null
          let pPageRowData = (this.pPageRow && !this.$isEmptyObject(this.pPageRow)) ? JSON.parse(JSON.stringify(this.pPageRow)) : null
          hideExpressResult = commonUse_setWidgetStatus(JSON.parse(rowEventArray[i]['row_express']), rowItem, fixedValue, rowData, pPageRowData)
          break
        }
      }
      return hideExpressResult
    },
    // 将页码与数据关联
    // 需要三个参数：总数据，需要渲染的表格，关联的页码
    showData (myData, tableItem, pageItem) {
      tableItem.tableData = []
      if (myData.length) {
        let from = (pageItem.options.currentPage - 1) * pageItem.options.pageSize
        let to = pageItem.options.currentPage * pageItem.options.pageSize
        if (to > myData.length) {
          to = myData.length
        }
        for (; from < to; from++) {
          tableItem.tableData.push(myData[from])
        }
      }
    },
    // 底部页码的部分
    handleSizeChange (val, widget) {
      let relatedTable = null
      // 获取关联的表格
      if (widget.relatedComponents.length) {
        widget.relatedComponents.forEach(item => {
          if (item.modelKey && item.modelKey.slice(0, item.modelKey.indexOf('_')) === 'table') {
            relatedTable = commonUse_getRelatedComponents(this.pageFormInfo.list, item.modelKey)
          }
        })
      }
      // 改变当前页码的参数
      widget.options.pageSize = val
      // 渲染表格
      if (relatedTable) {
        let initDataEvent = this.getEventsByTagModel(relatedTable.model, 'initTable')
        if (initDataEvent && initDataEvent.pageType === 'back' && initDataEvent.eventsNo) {
          // 后台分页
          this.$store.dispatch('changRouteLoading', true)
          this.getEventsInfoByEventNo(initDataEvent.eventsNo, 'isBack', relatedTable, null, null)
        } else {
          if (widget.options.isSearch) {
            this.showData(relatedTable.filterData, relatedTable, widget)
          } else {
            this.showData(relatedTable.totalData, relatedTable, widget)
          }
        }
      }
    },
    handleCurrentChange (val, widget) {
      let relatedTable = null
      // 获取关联的表格
      if (widget.relatedComponents.length) {
        widget.relatedComponents.forEach(item => {
          if (item.modelKey && item.modelKey.slice(0, item.modelKey.indexOf('_')) === 'table') {
            relatedTable = commonUse_getRelatedComponents(this.pageFormInfo.list, item.modelKey)
          }
        })
      }
      // 改变当前页码的参数
      widget.options.currentPage = val
      // 渲染表格
      if (relatedTable) {
        let initDataEvent = this.getEventsByTagModel(relatedTable.model, 'initTable')
        if (initDataEvent && initDataEvent.pageType === 'back' && initDataEvent.eventsNo) {
          // 后台分页
          this.$store.dispatch('changRouteLoading', true)
          this.getEventsInfoByEventNo(initDataEvent.eventsNo, 'isBack', relatedTable, null, null)
        } else {
          if (widget.options.isSearch) {
            this.showData(relatedTable.filterData, relatedTable, widget)
          } else {
            this.showData(relatedTable.totalData, relatedTable, widget)
          }
        }
      }
    },
    // 表格元素的检索方法----按钮点击检索、输入直接触发检索
    getSearchDataInfo (widget, val) {
      // 找到关联的表格
      let relatedTable = null
      let relatedTableKey = null // 前端分页时，关联的元素
      if (widget.relatedComponents.length) {
        widget.relatedComponents.forEach(item => {
          if (item.modelKey && item.relatedType === 'search' && item.modelKey.slice(0, item.modelKey.indexOf('_')) === 'table') {
            relatedTable = commonUse_getRelatedComponents(this.pageFormInfo.list, item.modelKey)
            relatedTableKey = item.relatedKey
          }
        })
      }
      // 通过关联的表找到关联的page
      let relatedPage = null
      if (relatedTable) {
        if (relatedTable.relatedComponents.length) {
          relatedTable.relatedComponents.forEach(item => {
            if (item.modelKey && item.modelKey.slice(0, item.modelKey.indexOf('_')) === 'pagination') {
              relatedPage = commonUse_getRelatedComponents(this.pageFormInfo.list, item.modelKey)
            }
          })
        }
      }
      if (relatedTable && relatedPage) {
        let initDataEvent = this.getEventsByTagModel(widget.model, 'searchInfo')
        if (initDataEvent && initDataEvent.pageType === 'back' && initDataEvent.eventsNo) {
          // 后台分页
          if (!this.$store.state.routerIsLoading) {
            this.$store.dispatch('changRouteLoading', true)
            relatedPage.options.currentPage = 1
            this.getEventsInfoByEventNo(initDataEvent.eventsNo, 'isBack', relatedTable, null, null)
          }
        } else {
          // 前端分页
          if (val) {
            // 检索框中有内容输入时
            relatedTable['filterData'] = []
            if (relatedTable.totalData.length) {
              relatedTable.totalData.forEach(item => {
                let surnPush = false
                for (let i = 0; i < relatedTableKey.length; i++) {
                  if (item[relatedTableKey[i]].indexOf(val) >= 0) {
                    surnPush = true
                    break
                  }
                }
                if (surnPush) {
                  relatedTable['filterData'].push(item)
                }
              })
            }
            relatedPage.options['isSearch'] = true
            relatedPage.options.currentPage = 1
            relatedPage.options.totalLength = relatedTable['filterData'].length
            // 调用方法进行页面渲染
            this.showData(relatedTable['filterData'], relatedTable, relatedPage)
          } else {
            // 没有输入内容时
            relatedTable['filterData'] = []
            relatedPage.options['isSearch'] = false
            relatedPage.options.currentPage = 1
            relatedPage.options.pageSize = 10
            relatedPage.options.totalLength = relatedTable['totalData'].length
            // 调用方法进行页面渲染
            this.showData(relatedTable['totalData'], relatedTable, relatedPage)
          }
        }
      }
    },
    // 页面中需要点击的事件部分
    // 1.表格行事件
    triggerRowEvent (currentRow, e) {
      let eventsType = ''
      let eventItem = {}
      if (this.widget.type === 'listBoxTable'){
        eventsType = e.eventsType
        eventItem = e.events
      } else {
        eventsType = e[0].eventsType
        eventItem = e
      }
      if (eventsType === 'editTable' || eventsType === 'selfDefineDialogTable' || eventsType === 'showDetail') {
        let toParentForm = {
          clickRow: currentRow,
          eventsArray: eventItem
        }
        this.$emit('openDialog', toParentForm)
      } else if (eventsType === 'deleteTable' || eventsType === 'activeTable' || eventsType === 'deactiveTable' || eventsType === 'selfDefineTable') {
        let msg = eventsType === 'deleteTable' ? '此操作将永久删除改行信息, 是否继续?' : (eventsType === 'activeTable' ? '确定要执行启用操作?' : (eventsType === 'deactiveTable' ? '确定要执行停用操作?' : '确定要执行' + eventItem[0].selfName + '操作?'))
        this.$confirm(msg, '提示', {
          confirmButtonText: '确定',
          cancelButtonClass: 'el-button--info',
          cancelButtonText: '取消'
        }).then(() => {
          let toParentForm = {
            clickRow: currentRow,
            eventsArray: eventItem
          }
          this.$emit('handelRowEvents', toParentForm)
        }).catch(() => {})
      } else if (eventsType === 'selfDefineTable_export') {
        // 表格行事件导出报表时
        // 表格行的导出事件时
        let msg = '确定要执行导出操作?'
        this.$confirm(msg, '提示', {
          confirmButtonText: '确定',
          cancelButtonClass: 'el-button--info',
          cancelButtonText: '取消'
        }).then(() => {
          // 自定义导出按钮时
          this.$store.dispatch('changRouteLoading', true)
          if (eventItem[0].eventsNo) {
            this.currentEventsObj = {
              inputDic: eventItem[0].inputDic,
              outputDic: eventItem[0].outputDic,
              eventsNo: eventItem[0].eventsNo
            }
            this.getEventsInfoByEventNo(eventItem[0].eventsNo, null, null, 'selfDefineTable_export', null)
          }
        }).catch(() => {})
      } else if (eventsType === 'selfDefinePageTable') {
        // 在系统内新的页面打开
        if (eventItem && eventItem.length && eventItem[0].dialogUid) {
          let path = this.$route.path === '/dashboard/dynamicWorkflowMenu' ? '/dashboard/dynamicWorkflowMenuPage' : '/dashboard/dynamicMenuPage'
          this.$router.push({
            path: path,
            query: {
              uid: eventItem[0].dialogUid,
              // fatherUid:  this.$route.query.fatherUid ? this.$route.query.fatherUid : this.dynamicUid,
              // fatherName:  this.$route.query.fatherName ? this.$route.query.fatherName : this.fatherName,
              fatherUid: this.dynamicUid,
              fatherName: this.fatherName,
              clickRow: currentRow ? JSON.stringify(currentRow) : ''
            }
          })
        } else {
          this.$message({
            message: '还没有指定需要打开的页面，请前往资源管理进行配置',
            type: 'warning'
          })
        }
      } else if (eventsType === 'selfDefinePageTable_openPage') {
        // 在系统外新的页面打开
        if (eventItem && eventItem.length && eventItem[0].linkUrlExpress) {
          let newUrl = eventItem[0].linkUrlExpress
          if (newUrl.indexOf('?') !== -1) {
            let ResultSearchString = ''
            let baseUrl = newUrl.slice(0, newUrl.indexOf('?'))
            let searchString = newUrl.slice(newUrl.indexOf('?') + 1)
            let searchArray = searchString.split('&')
            for (let i = 0; i < searchArray.length; i++) {
              let searchSingleArray = searchArray[i].split('=')
              let stringS = searchSingleArray[0] + '=' + this.getInputParamsMethods(searchSingleArray[1], '', currentRow)
              ResultSearchString += stringS
              if (i < searchArray.length - 1) {
                ResultSearchString += '&'
              }
            }
            let resultPageUrl = baseUrl + '?' + ResultSearchString
            window.open(resultPageUrl, '_blank')
          } else {
            window.open(newUrl, '_blank')
          }
        } else {
          this.$message({
            message: '还没有指定需要打开的页面，请前往资源管理进行配置',
            type: 'warning'
          })
        }
      }
    },
    // 2.按钮点击事件
    triggerClickEvent (widget) {
      // 根据元素的model获取其绑定的事件
      let tagEvent = this.getEventsByTagModel(widget.model)
      if (tagEvent && tagEvent.length) {
        if (tagEvent[0].eventsType === 'addDialogForm' || tagEvent[0].eventsType === 'editDialogForm') {
          // 新增或者编辑的带有弹窗的事件(只会有一个事件)
          let toParentForm = {
            clickRow: '',
            eventsArray: tagEvent
          }
          this.$emit('openDialog', toParentForm)
        } else if (tagEvent[0].eventsType === 'submitForm' || tagEvent[0].eventsType === 'submitDialogForm') {
          let toParentForm = {
            eventsArray: tagEvent
          }
          this.$emit('getFormData', toParentForm)
        } else if (tagEvent[0].eventsType === 'resetForm' || tagEvent[0].eventsType === 'resetDialogForm') {
          // 取消提交的事件，也只会有一个事件
          let toParentForm = {
            eventsArray: tagEvent
          }
          this.$emit('resetFormData', toParentForm)
        } else if ( tagEvent[0].eventsType === 'searchInfo') {
          // 检索按钮时
          this.getSearchDataInfo(widget, '')
        } else if (tagEvent[0].eventsType === 'selfDefine_btnEvent' || tagEvent[0].eventsType === 'triggerEventType') {
          // 自定义执行事件/直接执行事件(不刷新页面)
          let toParentForm = {
            eventsArray: tagEvent
          }
          this.$emit('triggerSelfdefineEvent', toParentForm)
        } else if ( tagEvent[0].eventsType === 'exportReport') {
          if (tagEvent[0].eventsNo) {
            this.currentEventsObj = {
              inputDic: tagEvent[0].inputDic,
              outputDic: tagEvent[0].outputDic,
              eventsNo: tagEvent[0].eventsNo
            }
            this.getEventsInfoByEventNo(tagEvent[0].eventsNo, null, widget, 'exportReport', null)
          } else {
            this.$message({
              message: '该标签还没有设置任何事件，请在动态表单配置中进行设置',
              type: 'warning'
            })
          }
        } else if ( tagEvent[0].eventsType === 'importReport') {
          if (tagEvent[0].eventsNo) {
            this.currentEventsObj = {}
            this.$set(this.currentEventsObj, 'inputDic', tagEvent[0].inputDic)
            this.$set(this.currentEventsObj, 'outputDic', tagEvent[0].outputDic)
            this.$set(this.currentEventsObj, 'eventsNo', tagEvent[0].eventsNo)
            this.showImportDialog = true
          } else {
            this.$message({
              message: '该标签还没有设置任何事件，请在动态表单配置中进行设置',
              type: 'warning'
            })
          }
        } else if (tagEvent[0].eventsType === 'selfDefinePage') {
          // 在新的页面打开
          if (tagEvent[0].dialogUid) {
            let path = this.$route.path === '/dashboard/dynamicWorkflowMenu' ? '/dashboard/dynamicWorkflowMenuPage' : '/dashboard/dynamicMenuPage'
            this.$router.push({
              path: path,
              query: {
                uid: tagEvent[0].dialogUid,
                // fatherUid:  this.$route.query.fatherUid ? this.$route.query.fatherUid : this.dynamicUid,
                // fatherName:  this.$route.query.fatherName ? this.$route.query.fatherName : this.fatherName,
                fatherUid: this.dynamicUid,
                fatherName: this.fatherName,
                clickRow: ''
              }
            })
          } else {
            this.$message({
              message: '还没有指定需要打开的页面，请前往资源管理进行配置',
              type: 'warning'
            })
          }
        } else if (tagEvent[0].eventsType === 'selfDefinePage_openPage') {
          // 在系统外新的页面打开
          if (tagEvent[0].linkUrlExpress) {
            let newUrl = tagEvent[0].linkUrlExpress
            if (newUrl.indexOf('?') !== -1) {
              let ResultSearchString = ''
              let baseUrl = newUrl.slice(0, newUrl.indexOf('?'))
              let searchString = newUrl.slice(newUrl.indexOf('?') + 1)
              let searchArray = searchString.split('&')
              for (let i = 0; i < searchArray.length; i++) {
                let searchSingleArray = searchArray[i].split('=')
                let stringS = searchSingleArray[0] + '=' + this.getInputParamsMethods(searchSingleArray[1])
                ResultSearchString += stringS
                if (i < searchArray.length - 1) {
                  ResultSearchString += '&'
                }
              }
              let resultPageUrl = baseUrl + '?' + ResultSearchString
              window.open(resultPageUrl, '_blank')
            } else {
              window.open(newUrl, '_blank')
            }
          } else {
            this.$message({
              message: '还没有指定需要打开的页面，请前往资源管理进行配置',
              type: 'warning'
            })
          }
        }
      } else {
        this.$message({
          message: '该标签还没有设置任何事情，请在动态表单配置中查看详细',
          type: 'warning'
        })
      }
    },
    // 3.点击表格的查看时
    clickRowOfFile (fileList) {
      this.currentRowFileList = (fileList && fileList.length) ? JSON.parse(JSON.stringify(fileList)) : []
      this.showUploadFileDialog_visible = true
    },
    // 某一个值变化时的联动操作
    setLinkageOptions (linkageOption, widget) {
      // 触发事件的方式进行联动
      if (linkageOption.linkageType === 'eventRender' && this.dialogType !== 'showDetail') {
        if (linkageOption.linkageEvents) {
          this.currentEventsObj = {
            inputDic: linkageOption.inputDic,
            outputDic: linkageOption.outputDic,
            eventsNo: linkageOption.linkageEvents
          }
          this.getEventsInfoByEventNo(linkageOption.linkageEvents, null, widget, 'changeClickRowData', null)
        } else {
          this.$message({
            message: '该字段为联动字段(数据渲染模式)，但尚未设置联动的方法，请前往资源管理进行设置',
            type: 'warning'
          })
        }
      } else if (linkageOption.linkageType === 'expressionRender' && this.dialogType !== 'showDetail' && Object.keys(linkageOption).indexOf('expressionArray') !== -1) {
        // 数据计算的方式触发事件
        if (!linkageOption.expressionArray.length) {
          let msg = '该字段为联动字段(数据计算模式)，但尚未设置计算表达式或计算字段（或表达式格式不正确），请前往资源管理进行设置'
          this.$message({
            message: msg,
            type: 'warning'
          })
        } else {
          this.$nextTick(() => {
            linkageOption.expressionArray.forEach(item => {
              if (item.expression.indexOf('=') !== -1) {
                let expression = item.expression.split('=')
                // 替换表达式中的符号
                let expressionSymolReplace = expression[1].replace(/\{\+\}/g, '+').replace(/\{-\}/g, '-').replace(/\{\/\}/g, '/').replace(/\{\*\}/g, '*').replace(/\{EQ\}/g, '=')
                // 通过计算字段，修改表达式中对应的值
                for (let i = 0; i < item.expressionElements.length; i++) {
                  let val = this.models[item.expressionElements[i]]
                  // 当该表达式的值没有时，默认设置为空
                  let replaceVal = 0
                  if (val) {
                    replaceVal = val
                    if (typeof(val) === 'string') {
                      replaceVal = '"' + val + '"'
                    }
                    // 值小于0时，避免出现--，/-等情况
                    if (val < 0) {
                      replaceVal = '(' + val + ')'
                    }
                  }
                  expressionSymolReplace = expressionSymolReplace.replace(new RegExp('{' + item.expressionElements[i] + '}', 'g'), replaceVal)
                }
                // 通过表达式获取到计算后的值
                if (expressionSymolReplace) {
                  let resultNumber = this.$selfdefineEval(expressionSymolReplace)
                  if (resultNumber === Infinity || resultNumber === -Infinity || isNaN(resultNumber)) {
                    resultNumber = null
                  }
                  this.$set(this.models, expression[0], resultNumber)
                  // 改变页面models的值
                  this.$emit('modelsChangedByLinkage', this.models)
                }
              }
            })
          })
        }
      } else if (linkageOption.linkageType === 'showRender' && this.dialogType !== 'showDetail') {
        // 显示和隐藏时
        this.$nextTick(() => {
          for (let i = 0; i < linkageOption.showExpression.length; i++) {
            if (linkageOption.showExpression[i].linkageElement && linkageOption.showExpression[i].showExpress) {
              let showExpress = linkageOption.showExpression[i].showExpress
              showExpress = showExpress.replace(/\{EQ\}/g, '=')
              if (linkageOption.showExpression[i].variableElement) {
                for (let t = 0; t < linkageOption.showExpression[i].variableElement.length; t++) {
                  let val = this.models[linkageOption.showExpression[i].variableElement[t]]
                  // 当该表达式的值没有时，默认设置为空
                  let replaceVal = null
                  if (val) {
                    replaceVal = val
                    if (typeof(val) === 'string') {
                      replaceVal = '"' + val + '"'
                    }
                  }
                  showExpress = showExpress.replace(new RegExp('{' + linkageOption.showExpression[i].variableElement[t] + '}', 'g'), replaceVal)
                }
              }
              // 获取关联显示元素的显示或隐藏的条件
              let hiddenCondition = !this.$selfdefineEval(showExpress)
              let changeStatusElement = commonUse_getRelatedComponents(this.pageFormInfo.list, linkageOption.showExpression[i].linkageElement)
              this.$set(changeStatusElement.options, 'isHidden', hiddenCondition)
            }
          }
        })
      } else if (linkageOption.linkageType === 'eventRenderDataSource' && this.dialogType !== 'showDetail') {
        // 数据源渲染(需调用接口获取数据更新下拉框等数据源)
        this.sorceEventArray = []
        if (linkageOption.sourceExpression.length) {
          linkageOption.sourceExpression.forEach(item => {
            if (item.eventsNo && item.linkageElement) {
              this.$set(this.models, item.linkageElement, null)
              // 改变页面models的值
              this.$emit('modelsChangedByLinkage', this.models)
              let sourceWidget = commonUse_getRelatedComponents(this.pageFormInfo.list, item.linkageElement)
              if (sourceWidget) {
                let obj = {
                  isTrigger: false,
                  eventsNo: item.eventsNo,
                  inputDic: item.inputDic,
                  outputDic: item.outputDic,
                  widget: sourceWidget
                }
                this.sorceEventArray.push(obj)
              }
            }
          })
          // 触发数据源事件，改变指定元素的数据源
          for (let i = 0; i < this.sorceEventArray.length; i++) {
            if (!this.sorceEventArray[i].isTrigger) {
              this.currentEventsObj = {
                inputDic: this.sorceEventArray[i].inputDic,
                outputDic: this.sorceEventArray[i].outputDic,
                eventsNo: this.sorceEventArray[i].eventsNo
              }
              this.getEventsInfoByEventNo(this.sorceEventArray[i].eventsNo, null, this.sorceEventArray[i].widget, 'changeDataSource', null)
              break
            }
          }
        } else {
          this.$message({
            message: '该字段为联动字段(数据源渲染模式)，但尚未配置联动的字段和相应的方法，请前往资源管理进行设置',
            type: 'warning'
          })
        }
      }
    },
    // 导出报表相关的
    downloadblob (blobcontent, filename) {
      if ('msSaveOrOpenBlob' in navigator) {
        // Microsoft Edge and Microsoft Internet Explorer 10-11
        window.navigator.msSaveOrOpenBlob(blobcontent, filename)
      } else {
        // 创建隐藏的可下载链接
        var eleLink = document.createElement('a')
        eleLink.download = filename
        eleLink.style.display = 'none'
        // 字符内容转变成blob地址
        eleLink.href = URL.createObjectURL(blobcontent)
        // 触发点击
        document.body.appendChild(eleLink)
        eleLink.click()
        // 然后移除
        document.body.removeChild(eleLink)
      }
    },
    // 将base64装为excel
    toBlob (base64str, filetype) {
      let bytes = window.atob(base64str)
      let n = bytes.length
      let u8arr = new Uint8Array(n)
      while (n--) {
        u8arr[n] = bytes.charCodeAt(n)
      }
      return new Blob([u8arr], {type: filetype})
    },
    // 导入文件成功时，需要刷新当前页面
    closeUploadDialogSuccess () {
      this.showImportDialog = false
      // 刷新当前页面
      this.$emit('reloadCurrentPage')
    },
    // 点击富文本编辑框时
    editElementData (widget) {
      this.showEditElementDataDialog = true
      // 当前控件的信息
      this.editElementObj = JSON.parse(JSON.stringify(widget))
      // 控件所属值的信息
      this.currentPageModelsObj = JSON.parse(JSON.stringify(this.models))
    },
    // 信息编辑成功时
    sureEditElementData (fromChild) {
      this.showEditElementDataDialog = false
      // 普通的字段信息时
      this.$set(this.models, this.editElementObj.model, fromChild)
      this.$emit('itemHadChangeModels', this.models)
    },
    // 初始化表格事件
    initListBoxTable () {
      // 将行事件情况
      this.widget.options.rowEvents = []
      let edic = {}
      if (this.pageFormInfo.pageConfig.events.length) {
        this.pageFormInfo.pageConfig.events.forEach(item => {
          let ekey = item.eventsType
          if (!item.selfName) {
            ekey += '__' + item.selfName
          }
          // 获取该表格的行事件
          if (item.relatedTag === this.widget.model && item.eventsType !== 'initTable') {
            let hadSameType = false
            for (let rowEventsKey in edic) {
              if (rowEventsKey === ekey) {
                hadSameType = true
                break
              }
            }
            if (!hadSameType) {
              edic[ekey] = {
                eventsType: item.eventsType,
                selfName: item.selfName,
                selfIconName: item.selfIconName,
                events: []
              }
            }
            edic[ekey].events.push(item)
          }
        })
      }
      if (edic) {
        for (let key in edic) {
          edic[key].events.sort(this.orderByObjAttr('actionIndex'))
        }
        this.widget.options.rowEvents = edic
      }
    },
    listBoxTableChanged (key) {
      this.widget.selectedValue = key
      if (this.widget.tableDataOptions.remoteFunc) {
        if (this.widget.tableDataOptions.inputDic && this.widget.tableDataOptions.outputDic) {
          this.currentEventsObj = {
            inputDic: this.widget.tableDataOptions.inputDic,
            outputDic: this.widget.tableDataOptions.outputDic,
            eventsNo: this.widget.tableDataOptions.remoteFunc
          }
        }
        this.showLoad(true)
        this.getEventsInfoByEventNo(this.widget.tableDataOptions.remoteFunc, null, this.widget, 'listBoxTableChanged', null)
      }
    },
    showLoad (isShow) {
      if (this.$refs[this.widget.key] && this.$refs[this.widget.key].showLoad) {
        this.$refs[this.widget.key].showLoad(isShow)
      }
    }
  },
  watch: {
    // 监听页面元素的值的改变
    dataModel: {
      deep: true,
      handler (val) {
        // 目前主要是做检索的判断
        if (this.widget.type !== 'table') {
          this.getSearchDataInfo(this.widget, val)
        }
        this.models[this.widget.model] = val
        this.$emit('itemHadChangeModels', this.models)
        if (Object.keys(this.widget.options).indexOf('linkageOption') !== -1 && this.widget.options.linkageOption.isLinkage && this.dialogType !== 'showDetail') {
          if ((this.widget.type !== 'input' || this.widget.options.linkageOption.linkageType !== 'eventRender') && this.widget.type !== 'number' && this.widget.type !== 'select') {
            this.setLinkageOptions(this.widget.options.linkageOption, this.widget)
          }
        }
      }
    },
    // 当页面初始化时，需要更新页面的数据
    changeModels: {
      handler: function (val) {
        if (!this.$isEmptyObject(this.models)) {
          this.dataModel = this.models[this.widget.model]
          if (this.widget.type === 'editTable') {
            // 获取可编辑表格中下拉框的事件集合
            this.getEditTableSelectArray()
          } else if (this.widget.type === 'date') {
            // 避免日期格式不正确，导致控件报错
            if (this.models[this.widget.model] && this.models[this.widget.model].indexOf('/') !== -1) {
              this.dataModel = this.models[this.widget.model].replace(/\//g, '-')
            }
          }
        }
      },
      deep: true
    }
  }
}